package com.hx.myapp;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.hx.myapp.widget.CustomDialog;

import util.ToastUtil;

public class CustomDialogActivity extends AppCompatActivity {
    private Button mBtnCustomDialog;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_custom);
        mBtnCustomDialog = findViewById(R.id.btn_custom_dialog);
        mBtnCustomDialog.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CustomDialog customDialog =new CustomDialog(CustomDialogActivity.this,R.style.CustomDialog);
                customDialog.setTitle("提示").setMessage("确认删除此项？").setCancel("取消", new CustomDialog.IonCancelListener() {
                    @Override
                    public void onCancel(CustomDialog dialog) {
                        ToastUtil.showMag(CustomDialogActivity.this,"cancel");
                        customDialog.dismiss();
                    }
                }).setConfirm("确认", new CustomDialog.IonConfirmListener() {
                    @Override
                    public void onConfirm(CustomDialog dialog) {
                        customDialog.dismiss();
                        ToastUtil.showMag(CustomDialogActivity.this,"已删除！");
                    }
                }).show();
            }
        });
    }
}